<?php 
class adminModel extends db_mongo{

	/**
	 * 根据条件获取admin的信息
	 * admin 有且仅有一个
	 * @param  [type] $condition [description]
	 * @return [type]            [description]
	 */
	public function get_admin_info(){

		$re_cursor = $this->select(array('name'=>'admin'));

		if(count($re_cursor) != 1){
			return false;
		}
		foreach ($re_cursor as $key => $value) {
			$admin_info = $value;
		}
		return $admin_info;
	}

	/**
	 * 判断登陆
	 */
	public function admin_login_judge($admin_data){

		$admin_info = $this->get_admin_info();

		if(ym_password($admin_data['pwd'] , $admin_info['_id']) != $admin_info['pwd']){
			return false;
		}
		return true;
	}


}
 ?>